<?php

class Application_Form_Page extends Zend_Form
{
    public function init()
    {
        $this->setName('Page');
        
        $page_id = new Zend_Form_Element_Hidden('page_id');
        $page_id->addFilter('Int');

        $name = new Zend_Form_Element_Text('name');
        $name->setLabel('Tên trang:')
              ->setRequired(true)
              ->addFilter('StripTags')
              ->addFilter('StringTrim')
              ->addValidator('NotEmpty');
              
//        $slug = new Zend_Form_Element_Text('slug');
//        $slug->setLabel('Slug:')
//               ->setRequired(true)
//               ->addFilter('StripTags')
//               ->addFilter('StringTrim')
//               ->addValidator('NotEmpty');
        
        $description = new Zend_Form_Element_Textarea('description');
        $description->setLabel('Mô tả:')
               ->setRequired(true)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addValidator('NotEmpty');
               
        $content = new Zend_Form_Element_Textarea('content');
        $content->setLabel('Nội dung:')
               ->setRequired(true)
               ->addFilter('StripTags')
               ->addFilter('StringTrim')
               ->addValidator('NotEmpty');

        $parent_id = new Zend_Form_Element_Select('parent_id');
        $parent_id->setLabel('Chuyên mục:')
        	   ->addFilter('Int');
        					  
               
       	$language = new Zend_Form_Element_Select('language');
        $language->setLabel('Ngôn ngữ :')
                ->setRequired(true)
                ->addMultiOptions(array(
                 	'en' => 'English',
                	'vi' => 'VietNam'
        ));
        $is_active = new Zend_Form_Element_Hidden('is_active');
        $created_date = new Zend_Form_Element_Hidden('created_date');
        $num_view = new Zend_Form_Element_Hidden('num_view');
        $user_id = new Zend_Form_Element_Hidden('user_id');
   //     $page_id->addFilter('Int');
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'AddButton');

        $cancel = new Zend_Form_Element_Submit('cancel');
        $cancel->setAttrib('id', 'CancelButton');
        
        $this->addElements(array($name, $parent_id, $language, $description, $content, $page_id,$is_active,$created_date,$num_view,$user_id,  $submit, $cancel));
    }
}